package code.part06_Thread;

/**
 * @author: ZJT
 * @Time: 2021/7/22
 * @Description: 多线程 sleep
 */
public class P06_Sleep {

    public static void main(String[] args) {
        MyRun run = new MyRun();
        Thread thread = new Thread(run);
        thread.start();

        for (int i = 0; i < 5; i++) {
            System.out.println(Thread.currentThread().getName() + "==============" + i);
            if (i == 0) {
                try {
                    //使用当前正在执行的线程休眠millis秒,线程处于阻塞状态
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
